function countdown(time, dom_id) {
    let remainingTime = time;
  
    // 从localStorage中获取剩余时间，如果没有则使用传入的time
    if (localStorage.getItem('remainingTime')) {
      remainingTime = parseInt(localStorage.getItem('remainingTime'));
    } else {
      localStorage.setItem('remainingTime', time);
    }
  
    const intervalId = setInterval(() => {
      // 更新剩余时间
      remainingTime -= 1;
      localStorage.setItem('remainingTime', remainingTime);
  
      // 计算小时、分钟和秒
      const hours = Math.floor(remainingTime / 3600);
      const minutes = Math.floor((remainingTime % 3600) / 60);
      const seconds = remainingTime % 60;
  
      // 显示剩余时间
      document.getElementById(`${dom_id}`).innerText = `${hours}时${minutes}分${seconds}秒`;
  
      // 如果倒计时结束，清除interval并移除localStorage中的剩余时间
      if (remainingTime <= 0) {
        clearInterval(intervalId);
        localStorage.removeItem('remainingTime');
      }
    }, 1000);
  }
  export default countdown;